package com.wl.basic.listener;

import com.wl.system.service.impl.PermissionScanServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class PermissionScanInitListener implements ServletContextListener {
    @Autowired
    private PermissionScanServiceImpl permissionScanService;
    @Override
    public void contextInitialized(ServletContextEvent sce) {
       new Thread(new Runnable() {
           @Override
           public void run() {
               System.out.println("权限注解扫描开始");
               //调用PermissionScanServiceImpl的方法
               permissionScanService.scanPermission();
               System.out.println("权限注解扫描结束");
           }
       }).start();
    }
}

